/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ACH.mod.Snippet;
//import Snippet.Search;
import java.io.IOException;
import org.json.JSONException;
/**
 *
 * @author adriancruz11c
 * @usage: aplication search #consultas
 * el total de snippets =  (#consultas*10) +-9
 * 
 */
public class getSnippetWebG extends Search{
    /* ejemplo de argumentos:
     *      "anger * rage" 50 
     *      "lexical~unity1 lexical~unity2" 99
     *      "red~car * ford" 1
     *  : el espacio dentro de una unidad léxica debe ser sustituido por el caracter ~
     */
    public static void main(String[] q) throws IOException, JSONException{
        if(q.length>=2){ 
            String []x=q[0].split(" ");
            
            for(int i=0;i<x.length-1;i++){
                if (!(x[i].equals("*") || x[i].equals("+") || x[i].equals("OR") || x[i].equals("AND") || x[i].equals("NOT")))
                    x[i]="\""+x[i]+"\"";
            }
            q[0]="";
            for (String elems : x)
                q[0]=q[0]+elems.replace('~', ' ').replace('+', '*') +" "; 
                
            //... se puede obtener q (query) desde consola ...
            String search=q[0];
            //String search="CENIDET"; // uso de operadores es valido: AND, OR, NOT, ...
            //System.out.println(search+ ", "+Integer.parseInt(q[1]));                         
            /*String summary[] = mainPrint(search, Integer.parseInt(q[q.length-1]));            
            for (String elems : summary)
                System.out.println(elems);*/
        }else{
            System.out.println("null # de argumentos invalido null");
        }
    }
}

//java pro arg1 arg2
